Skip to content

fix(project): handle registry list retrieval error gracefully#1014

Open
saiashok0981 wants to merge 1 commit into
goharbor:mainfrom
saiashok0981:fix/project-create-registry-list-resilience
Open

fix(project): handle registry list retrieval error gracefully#1014
saiashok0981 wants to merge 1 commit into
goharbor:mainfrom
saiashok0981:fix/project-create-registry-list-resilience

Conversation

@saiashok0981

Copy link
Copy Markdown

Summary

This PR makes interactive project creation resilient to registry listing API failures.

Rationale & Design Decisions

  • Currently, if the Registry listing endpoint fails or is unauthorized, CreateProjectView fails immediately.
  • Listing registries is only required for selecting a proxy cache registry.
  • By handling the error gracefully (logging a debug message and passing an empty list of options), standard project creation remains functional for users without administrative registry access.
    Signed-off-by: saiashok103@gmail.com

@qcserestipy

Copy link
Copy Markdown
Collaborator

Looking at both getRegistryList() and ListRegistries(), the nil checks here seem unnecessary. Both wrappers return nil, err on failure and response, nil on success. If the generated client could theoretically return nil, nil, that should probably be guarded once in the wrapper rather than in every caller.

Also, checking Payload != nil is not needed because ranging over a nil or empty slice is safe in Go.

The actual behavior change is that errors from getRegistryList() are no longer returned. If the registry list is optional for rendering this view, logging and continuing makes sense, but we should make that intention explicit.

@qcserestipy

Copy link
Copy Markdown
Collaborator

Also DCO is failing and this PR has no linked issue

@qcserestipy qcserestipy added invalid This doesn't seem right Changes Requesed feedback that must be addressed before merging. no-issue This PR has now issue that has been discussed on the scope of the PR labels Jul 6, 2026
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 9.34%. Comparing base (60ad0bd) to head (62e1b68).
⚠️ Report is 191 commits behind head on main.

Files with missing lines Patch % Lines
pkg/views/project/create/view.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             main   #1014      +/-   ##
=========================================
- Coverage   10.99%   9.34%   -1.65%     
=========================================
  Files         173     321     +148     
  Lines        8671   16083    +7412     
=========================================
+ Hits          953    1503     +550     
- Misses       7612   14446    +6834     
- Partials      106     134      +28     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes Requesed feedback that must be addressed before merging. invalid This doesn't seem right no-issue This PR has now issue that has been discussed on the scope of the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants